import axios from 'axios'
import {ElMessage} from "element-plus";

export function getRoleList(params) {
    return axios.get('/role/list', { params })
}

export function getRole(roleId) {
    return axios.get(`/role/${roleId}`)
}

export function addRole(data) {
    return axios.post('/role', data)
}

export function updateRole(data) {
    return axios.put('/role', data)
}

export function deleteRole(roleId) {
    return axios.delete(`/role/${roleId}`)
}

export function updateRoleMenus(roleId, menuIds) {
    return axios.post(`/role/${roleId}/updateMenus`, menuIds);
}

export function getRoleUsers(roleId) {
    return axios.get(`/role/${roleId}/users`)
}

// 获取角色菜单权限
export function getRoleMenus(roleId) {
    return axios.get(`/role/${roleId}/menus`)
}
